<div ng-controller="FxproductCtrl" ng-init="addAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/fxproduct/list">{{product_data.name}}</a></li>
        <li class="active">
            {{!product_id?"创建":"edit"|translate}}
        </li>
    </ul>
    <form name="Fxproductform" class="sui-form form-horizontal" novalidate>
        <div mywizard class="sui-steps">
            <step>
                <label><span class="round">1</span><span>产品线设置</span></label>
                <i class="triangle-right-bg"></i><i class="triangle-right"></i>
            </step>
            <step>
                <label><span class="round">2</span><span>设置商品</span></label>
                <i class="triangle-right-bg"></i><i class="triangle-right"></i>
            </step>
            <step>
                <label><span class="round">3</span><span>分销商等级设置</span></label>
                <i class="triangle-right-bg"></i><i class="triangle-right"></i>
            </step>
            <step>
                <label><span class="round">4</span><span>完成</span></label>
                <i class="triangle-right-bg"></i><i class="triangle-right"></i>
            </step>
            <div stepcontent0 class="stepContent">
                <div class="stepbody">
                    <div class="control-group">
                        <label class="control-label v-top">
                            产品线名称：
                        </label>
                        <div class="controls">
                            <input id="name" type="text" name="name" ng-model="product_data.name" />
                            <div ng-show="product_data.name.length==0||product_data.name.length>5" class="sui-msg msg-error msg-clear help-block error">
                                <div class="msg-con">活动标题不能超过5个字</div>
                                <s class="msg-icon"></s>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            全店返点比例：
                        </label>
                        <div class="controls">
                            <input id="proportion" ng-model="product_data.proportion" name="proportion">%
                        </div>
                    </div>
                    <div class="control-group zhide">
                        <label class="control-label">
                            活动类型：
                        </label>
                        <div class="controls">
                            <label data-toggle="radio" class="radio-pretty inline {{product_data.type == 1?'checked':''}} {{ (product_data.type==2&&product_id) ? 'disabled':'' }}">
                                <input type="radio" name="radio" ng-checked="{{product_data.type==1}}" ng-model="product_data.type" value="1"><span>全店商品参加</span>
                            </label>
                            <label data-toggle="radio" class="radio-pretty inline {{product_data.type == 2?'checked':''}} {{ (product_data.type == 1 && product_id) ? 'disabled':'222' }}">
                                <input type="radio" name="radio" ng-model="product_data.type" ng-checked="{{product_data.type==2}}" value="2"><span>部分商品参加</span>
                            </label>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            备注：
                        </label>
                        <div class="controls">
                            <input id="remark" ng-model="product_data.remark" name="remark">
                        </div>
                    </div>
                </div>
                <div>
                    <button class="sui-btn btn-primary zhide" ng-click="productAdd();">{{"save"|translate}}</button>
                    
                    <button type="button" id="next2" class="sui-btn btn-primary" mywizard-next ng-click="nextAdd();">{{'下一步 设置商品'|translate}}</button>
                </div>
            </div>
            <div stepcontent1 class="stepContent">
                <div class="stepbody">
                    <div class="sui-msg msg-block msg-stop">
                        <div class="msg-con">如果商品返点比例与全店返点比例 <span style="font-weight:bold;color:#f00;">{{product_data.proportion}}%</span> 不一致的话，需要在这个页面单独设置。</div>
                        <s class="msg-icon"></s>
                    </div>
                    <ul id="tab-demo" class="sui-nav nav-tabs nav-primary">
                        <li class="active"><a href="#default1" data-toggle="tab" ng-click="tabCut($event);checkedBroadcast();">已参加</a></li>
                        <li>
                            <a href="#custom1" data-toggle="tab" ng-click="tabCut($event);broadcast();">添加商品</a>
                        </li>
                        <li>
                            <a href="#custom2" data-toggle="tab" ng-click="tabCut($event);huodongBroadcast();">添加活动</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div id="default1" class="tab-pane active">
                            <productcat-checked-item-list callback="itemGet1(fenxiao_item_num);"></productcat-checked-item-list>
                        </div>
                        <div id="custom1" class="tab-pane">
                            <productcat-item-list callback="itemGet1(fenxiao_item_num);"></productcat-item-list>
                        </div>
                        <div id="custom2" class="tab-pane">
                            <productcat-huodong-list callback="itemGet1(fenxiao_item_num);"></productcat-huodong-list>
                        </div>
                    </div>
                </div>
                <div>
                    <button type="button" class="sui-btn btn-primary" mywizard-previous>上一步</button>
                    <!-- && fenxiao_item_num -->
                    <button ng-show="product_data.product_id" type="button" class="sui-btn btn-primary" ng-click="getGradeList(1);" mywizard-next>{{'下一步 设置分销商等级'|translate}}</button>
                </div>
            </div>
            <div stepcontent2 class="stepContent">
                <div class="stepbody">
                    <div ng-show="grade_list.length">
                        <table class="sui-table table-bordered">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>{{'Name'|translate}}</th>
                                    <th>{{'grade_value'|translate}}</th>
                                    <th>{{'amount'|translate}}</th>
                                    <th>{{'count'|translate}}</th>
                                    <th>{{'remark'|translate}}</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="list1 in grade_list">
                                    <td>
                                        <label data-toggle="radio" class="radio-pretty inline {{product_data.grade_id == list1.grade_id ?'checked':''}}">
                                            <input type="radio" name="radio1" ng-model="product_data.grade_id" value="{{list1.grade_id}}" ng-checked="product_data.grade_id == list1.grade_id ?'checked':''"><span> </span>
                                        </label>
                                    </td>
                                    <td>{{list1.name}}</td>
                                    <td>{{list1.value}}</td>
                                    <td>
                                        {{list1.trade_amount}}
                                    </td>
                                    <td>{{list1.trade_number}}</td>
                                    <td>{{list1.remark}}</td>
                                </tr>
                            </tbody>
                        </table>
                        <pager page-no="1" page-size="pageSize" total="total_number" get-data="getGradeList(pageNo)"></pager>
                    </div>
                    <div ng-show="!grade_list.length">
                        <span style="color: #f00;">没有设置分销商等级，请先创建分销商等级，点击<button type="button" class="sui-btn btn-primary" ng-click="addGrade();">创建</button>。</span>
                    </div>
                </div>
                <div>
                    <button type="button" class="sui-btn btn-primary" mywizard-previous>上一步</button>
                    <button class="sui-btn btn-primary" ng-click="upGrade();" ng-show="product_data.grade_id != 0">保存</button>
                </div>
            </div>
            <div class="stepContent zhide">
                <div class="stepbody">
                    <div class="control-group">
                        <label class="control-label">{{'has_invoice'|translate}}：</label>
                        <div class="controls">
                            <bool-select ng-model="trade.has_invoice"></bool-select>
                        </div>
                    </div>
                    <div ng-show="trade.has_invoice">
                        <div class="control-group">
                            <label class="control-label">{{'invoice_type'|translate}}：</label>
                            <div class="controls">
                                <input type="text" name="invoice_type" value="" ng-model="trade.invoice_type" class="input-xlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">{{'title'|translate}}：</label>
                            <div class="controls">
                                <input type="text" name="invoice_title" value="" ng-model="trade.invoice_title" class="input-xlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">{{'invoice_fee'|translate}}：</label>
                            <div class="controls">
                                <input type="number" name="invoice_fee" value="" ng-model="trade.invoice_fee" class="input-xlarge">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">{{'invoice_desc'|translate}}：</label>
                            <div class="controls">
                                <textarea type="text" name="invoice_desc" value="" ng-model="trade.invoice_desc" class="input-xlarge"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <button type="button" class="sui-btn btn-primary" mywizard-previous>{{'Last step'|translate}}</button>
                    <button type="submit" class="sui-btn btn-primary zhide">
                        {{'创建'|translate}}
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>